home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / PCCardTuples.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  13.5 KB  |  458 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        PCCardTuples.h
  3.  
  4.      Contains:    List of PCMCIA tuple types and definitions of tuple contents.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1994-1999 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __PCCARDTUPLES__
  18. #define __PCCARDTUPLES__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24.  
  25.  
  26.  
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_STRUCT_ALIGN
  40.     #pragma options align=mac68k
  41. #elif PRAGMA_STRUCT_PACKPUSH
  42.     #pragma pack(push, 2)
  43. #elif PRAGMA_STRUCT_PACK
  44.     #pragma pack(2)
  45. #endif
  46.  
  47. enum {
  48.     MAX_TUPLE_SIZE                = 256
  49. };
  50.  
  51. /*------------------------------------------------------------------------
  52.     Defines for Tuple codes
  53. ------------------------------------------------------------------------*/
  54. enum {
  55.     CISTPL_NULL                    = 0x00,
  56.     CISTPL_DEVICE                = 0x01,
  57.     CISTPL_LONGLINK_CB            = 0x02,
  58.     CISTPL_INDIRECT                = 0x03,
  59.     CISTPL_CONFIG_CB            = 0x04,
  60.     CISTPL_CFTABLE_ENTRY_CB        = 0x05,
  61.     CISTPL_LONGLINK_MFC            = 0x06,
  62.     CISTPL_BAR                    = 0x07,
  63.     CISTPL_CHECKSUM                = 0x10,
  64.     CISTPL_LONGLINK_A            = 0x11,
  65.     CISTPL_LONGLINK_C            = 0x12,
  66.     CISTPL_LINKTARGET            = 0x13,
  67.     CISTPL_NO_LINK                = 0x14,
  68.     CISTPL_VERS_1                = 0x15,
  69.     CISTPL_ALTSTR                = 0x16,
  70.     CISTPL_DEVICE_A                = 0x17,
  71.     CISTPL_JEDEC_C                = 0x18,
  72.     CISTPL_JEDEC_A                = 0x19,
  73.     CISTPL_CONFIG                = 0x1A,
  74.     CISTPL_CFTABLE_ENTRY        = 0x1B,
  75.     CISTPL_DEVICE_OC            = 0x1C,
  76.     CISTPL_DEVICE_OA            = 0x1D,
  77.     CISTPL_DEVICE_GEO            = 0x1E,
  78.     CISTPL_DEVICE_GEO_A            = 0x1F,
  79.     CISTPL_MANFID                = 0x20,
  80.     CISTPL_FUNCID                = 0x21,
  81.     CISTPL_FUNCE                = 0x22,
  82.     CISTPL_SWIL                    = 0x23,
  83.     CISTPL_VERS_2                = 0x40,
  84.     CISTPL_FORMAT                = 0x41,
  85.     CISTPL_GEOMETRY                = 0x42,
  86.     CISTPL_BYTEORDER            = 0x43,
  87.     CISTPL_DATE                    = 0x44,
  88.     CISTPL_BATTERY                = 0x45,
  89.     CISTPL_ORG                    = 0x46,
  90.     CISTPL_VENDOR                = 0xFE,
  91.     CISTPL_END                    = 0xFF
  92. };
  93.  
  94.  
  95. /*------------------------------------------------------------------------
  96.     Tuple Data Block Definitions
  97. ------------------------------------------------------------------------*/
  98.  
  99. /*------------    Device Information Tuple (01H, 17H)    -----------                            */
  100.  
  101.  
  102. struct DeviceIDTuple {
  103.     Byte                             TPLDEV_TYPE_WPS_SPEED;        /* Device Type Code: 7-4, WPS: 3,  Device Speed: 2-0*/
  104.     Byte                             deviceData[253];
  105. };
  106. typedef struct DeviceIDTuple            DeviceIDTuple;
  107. enum {
  108.     TPLDEV_TYPE_MASK            = 0xF0,                            /* device type mask for TPLDEV_TYPE_WPS_SPEED*/
  109.     TPLDEV_TYPE_EXTENDED        = 0xE0,                            /* device type value for extended type*/
  110.     TPLDEV_WPS_MASK                = 0x08,                            /* write-protect switch mask for TPLDEV_TYPE_WPS_SPEED*/
  111.     TPLDEV_SPEED_MASK            = 0x07,                            /* device speed mask for TPLDEV_TYPE_WPS_SPEED*/
  112.     TPLDEV_DSPEED_NULL            = 0x00,                            /* speed for null device type*/
  113.     TPLDEV_DSPEED_250NS            = 0x01,                            /* 250ns card access time*/
  114.     TPLDEV_DSPEED_200NS            = 0x02,                            /* 200ns card access time*/
  115.     TPLDEV_DSPEED_150NS            = 0x03,                            /* 150ns card access time*/
  116.     TPLDEV_DSPEED_100NS            = 0x04,                            /* 100ns card access time*/
  117.     TPLDEV_EXTENDED_SPEED        = 0x07,                            /* device speed value for extended speed*/
  118.     TPLDEV_SPEED_EXPONENT        = 0x07,                            /* extended byte exponent mask*/
  119.     TPLDEV_SPEED_MANTISSA        = 0x78,                            /* extended byte mantissa mask*/
  120.     TPLDEV_SPEED_EXTENDED_MASK    = 0x80                            /* bit set if more extended speed data follows*/
  121. };
  122.  
  123.  
  124. /*    device ID types*/
  125.  
  126. enum {
  127.     DTYPE_NULL                    = 0,
  128.     DTYPE_ROM                    = 1,
  129.     DTYPE_OTPROM                = 2,
  130.     DTYPE_EPROM                    = 3,
  131.     DTYPE_EEPROM                = 4,
  132.     DTYPE_FLASH                    = 5,
  133.     DTYPE_SRAM                    = 6,
  134.     DTYPE_DRAM                    = 7,
  135.     DTYPE_FUNCSPEC                = 0x0D,
  136.     DTYPE_EXTEND                = 0x0E
  137. };
  138.  
  139.  
  140. /*---------------    Checksum Control Tuple (10H)    ---------------                            */
  141.  
  142.  
  143. struct ChecksumControlTuple {
  144.     short                             TPLCKS_ADDR;                /* offset to region to be checksummed, LSB first*/
  145.     short                             TPLCKS_LEN;                    /* length of region to be checksummed, LSB first*/
  146.     char                             TPLCKS_CS;                    /* checksum of the region*/
  147.     Byte                             reserved;                    /* padding*/
  148. };
  149. typedef struct ChecksumControlTuple        ChecksumControlTuple;
  150. /*----------------    Long Link Multi-Function Tuple (06H)    ------                    */
  151.  
  152.  
  153. struct LongLinkMFCTuple {
  154.     UInt8                             TPLMFC_NUM;                    /* Number of sets of config registers for individual functions*/
  155.  
  156.     UInt8                             TPLMFC_TAS1;                /* CIS target address space for first function (00 = Attr, 01 = Common)*/
  157.     UInt32                             TPLMFC_ADDR1;                /* Target address of first CIS, unsigned long, lsb first*/
  158.  
  159.     UInt8                             TPLMFC_TAS2;                /* CIS target address space for second function (00 = Attr, 01 = Common)*/
  160.     UInt8                             TPLMFC_ADDR2[4];            /* [MISALIGNED!] Target address of second CIS, unsigned long, lsb first*/
  161.  
  162.                                                                 /* the following fields are of undetermined length and should be calculated at runtime*/
  163.                                                                 /* */
  164.                                                                 /* UInt8        TPLMFC_TASn;*/
  165.                                                                 /* UInt32        TPLMFC_ADDRn;*/
  166. };
  167. typedef struct LongLinkMFCTuple            LongLinkMFCTuple;
  168. /*----------------    Long Link Tuple (11H, 12H)    ----------------                            */
  169.  
  170.  
  171. struct LongLinkTuple {
  172.     UInt32                             TPLL_ADDR;                    /* target address, LSB first*/
  173. };
  174. typedef struct LongLinkTuple            LongLinkTuple;
  175. /*-----------------    Link Target Tuple (13H)    ------------------                            */
  176.  
  177.  
  178. struct LinkTargetTuple {
  179.     Byte                             TPLL_TAG[3];                /* tag: should be 'C', 'I', 'S'*/
  180. };
  181. typedef struct LinkTargetTuple            LinkTargetTuple;
  182. /*----------------    Level 1 Version Tuple (15H)    ---------------                            */
  183.  
  184.  
  185. struct Level1VersionTuple {
  186.     Byte                             TPLLV1_MAJOR;                /* major version number (0x04)*/
  187.     Byte                             TPLLV1_MINOR;                /* minor version number (0x01 for release 2.0 and 2.01)*/
  188.     Byte                             TPLLV1_INFO[1];                /* product information string, zero-terminated*/
  189. };
  190. typedef struct Level1VersionTuple        Level1VersionTuple;
  191. /*-------------    JEDEC Identifier Tuple (18H, 19H)    ------------                            */
  192.  
  193.  
  194. struct JEDECDeviceInfo {
  195.     Byte                             manufacturerID;
  196.     Byte                             manufacturerInfo;
  197. };
  198. typedef struct JEDECDeviceInfo            JEDECDeviceInfo;
  199.  
  200. struct JEDECIdentifierTuple {
  201.     JEDECDeviceInfo                 device[1];
  202. };
  203. typedef struct JEDECIdentifierTuple        JEDECIdentifierTuple;
  204. /*---------    Configuration Tuple (1AH)    ----------                            */
  205.  
  206.  
  207. struct ConfigTuple {
  208.     Byte                             TPCC_SZ;                    /* size of fields byte*/
  209.     Byte                             TPCC_LAST;                    /* index number of last config entry*/
  210.     Byte                             TPCC_RADR;                    /* config reg's base addr in reg. space*/
  211.     Byte                             reserved;                    /* padding*/
  212.  
  213.                                                                 /* the following fields are of undetermined length and should be calculated at runtime*/
  214.                                                                 /*UInt32            TPCC_RMSK;*/
  215.                                                                 /*UInt32            TPCC_RSVD;*/
  216.                                                                 /*UInt32            TPCC_SBTPL;*/
  217. };
  218. typedef struct ConfigTuple                ConfigTuple;
  219. /*    TPCC_RADR field definitions*/
  220. enum {
  221.     TPCC_RASZ                    = 0x03,                            /* bits 1-0*/
  222.     TPCC_RMSZ                    = 0x3C,                            /* bits 5-2*/
  223.     TPCC_RFSZ                    = 0xC0                            /* bits 7-6*/
  224. };
  225.  
  226.  
  227. /*---------    Device Geometry Tuple (1EH, 1FH)    ----------*/
  228.  
  229.  
  230. struct DeviceGeometry {
  231.     UInt8                             DGTPL_BUS;                    /* system bus width = 2^(n-1), n>0*/
  232.     UInt8                             DGTPL_EBS;                    /* erase block size = 2^(n-1), n>0*/
  233.     UInt8                             DGTPL_RBS;                    /* read block size = 2^(n-1), n>0*/
  234.     UInt8                             DGTPL_WBS;                    /* write block size = 2^(n-1), n>0*/
  235.     UInt8                             DGTPL_PART;                    /* partitioning size = 2^(n-1), n>0*/
  236.     UInt8                             DGTPL_HWIL;                    /* hardware interleave = 2^(n-1), n>0*/
  237. };
  238. typedef struct DeviceGeometry            DeviceGeometry;
  239.  
  240. struct DeviceGeometryTuple {
  241.     DeviceGeometry                     device[42];
  242. };
  243. typedef struct DeviceGeometryTuple        DeviceGeometryTuple;
  244. /*---------    Manufacturer Identification Tuple (20H)    ----------                            */
  245.  
  246.  
  247. struct ManufIDTuple {
  248.     short                             TPLMID_MANF;                /* PCMCIA PC Card manufacturer code*/
  249.     short                             TPLMID_CARD;                /* manufacturer information (part number and/or revision)*/
  250. };
  251. typedef struct ManufIDTuple                ManufIDTuple;
  252. /*-----------    Function Identification Tuple (21H)    ------------                            */
  253.  
  254.  
  255. struct FunctionIDTuple {
  256.     Byte                             TPLFID_FUNCTION;            /* PC card function code*/
  257.     Byte                             TPLFID_SYSINIT;                /* system initialization bit mask*/
  258. };
  259. typedef struct FunctionIDTuple            FunctionIDTuple;
  260. /*    function codes*/
  261. enum {
  262.     TPLFID_MultiFunction        = 0,
  263.     TPLFID_Memory                = 1,
  264.     TPLFID_SerialPort            = 2,
  265.     TPLFID_ParallelPort            = 3,
  266.     TPLFID_FixedDisk            = 4,
  267.     TPLFID_VideoAdapter            = 5,
  268.     TPLFID_NetworkLANAdapter    = 6,
  269.     TPLFID_AIMS                    = 7,
  270.     TPLFID_SCSI                    = 8,
  271.     TPLFID_Security                = 9
  272. };
  273.  
  274.  
  275. /*------------    Software Interleave Tuple (23H)    ---------------                            */
  276.  
  277.  
  278. struct SoftwareInterleaveTuple {
  279.     char                             TPLSWIL_INTRLV;                /* software interleave*/
  280. };
  281. typedef struct SoftwareInterleaveTuple    SoftwareInterleaveTuple;
  282. /*-------    Level 2 Version and Information Tuple (40H)    --------                            */
  283.  
  284.  
  285. struct Level2VersionTuple {
  286.     Byte                             TPLLV2_VERS;                /* structure version (0x00)*/
  287.     Byte                             TPLLV2_COMPLY;                /* level of compliance with the standard (0x00)*/
  288.     UInt16                             TPLLV2_DINDEX;                /* byte address of first data byte in card, LSB first*/
  289.     Byte                             TPLLV2_RSV6;                /* reserved, must be zero*/
  290.     Byte                             TPLLV2_RSV7;                /* reserved, must be zero*/
  291.     Byte                             TPLLV2_VSPEC8;                /* vendor specific byte*/
  292.     Byte                             TPLLV2_VSPEC9;                /* vendor specific byte*/
  293.     char                             TPLLV2_NHDR;                /* number of copies of CIS present on this device*/
  294.     char                             TPLLV2_OEM[1];                /* vendor of software that formatted card, zero-terminated*/
  295.     char                             TPLLV2_INFO[1];                /* informational message about the card, zero-terminated*/
  296.     Byte                             reserved;                    /* padding*/
  297. };
  298. typedef struct Level2VersionTuple        Level2VersionTuple;
  299. /*--------------------    Format Tuple (41H)    --------------------                            */
  300.  
  301. /* additional information for disk type:*/
  302.  
  303.  
  304. struct FormatDiskTuple {
  305.     UInt16                             TPLFMT_BKSZ;                /*    block size, or zero if unblocked format*/
  306.     UInt32                             TPLFMT_NBLOCKS;                /*    number of data blocks in this partition*/
  307.     UInt32                             TPLFMT_EDCLOC;                /*    location of error detection code, or zero if interleaved*/
  308. };
  309. typedef struct FormatDiskTuple            FormatDiskTuple;
  310. /* additional information for disk type:*/
  311.  
  312. struct FormatMemTuple {
  313.     Byte                             TPLFMT_FLAGS;                /*    various flags*/
  314.     Byte                             TPLFMT_RESERVED;            /*    reserved, set to zero*/
  315.     UInt32                             TPLFMT_ADDRESS;                /*    physical location at which this memory partion must be mapped*/
  316.     UInt32                             TPLFMT_EDCLOC;                /*    location of error detection code, or zero if interleaved*/
  317. };
  318. typedef struct FormatMemTuple            FormatMemTuple;
  319.  
  320. struct FormatTuple {
  321.     char                             TPLFMT_TYPE;                /* format type code*/
  322.     char                             TPLFMT_EDC;                    /* error detection method and length of error detection code*/
  323.     long                             TPLFMT_OFFSET;                /* offset to first data byte in this partition*/
  324.     long                             TPLFMT_NBYTES;                /* number of data bytes in this partition*/
  325.     union {
  326.         FormatDiskTuple                 TPLFMT_DISK;
  327.         FormatMemTuple                     TPLFMT_MEM;
  328.     }                                 u;
  329. };
  330. typedef struct FormatTuple                FormatTuple;
  331. /*    format types*/
  332. enum {
  333.     TPLFMTTYPE_DISK                = 0,
  334.     TPLFMTTYPE_MEM                = 1,
  335.     TPLFMTTYPE_VS                = 0x80
  336. };
  337.  
  338. /*    error detection types*/
  339.  
  340. enum {
  341.     TPLFMTEDC_NONE                = 0,
  342.     TPLFMTEDC_CKSUM                = 1,
  343.     TPLFMTEDC_CRC                = 2,
  344.     TPLFMTEDC_PCC                = 3,
  345.     TPLFMTEDC_VS                = 8
  346. };
  347.  
  348. /*    bits in TPLFMT_FLAGS*/
  349.  
  350. enum {
  351.     TPLFMTFLAGS_ADDR            = 0,
  352.     TPLFMTFLAGS_AUTO            = 1
  353. };
  354.  
  355.  
  356. /*------------------    Geometry Tuple (42H)    --------------------                            */
  357.  
  358.  
  359. struct GeometryTuple {
  360.     char                             TPLGEO_SPT;                    /* number of sectors per track*/
  361.     char                             TPLGEO_TPC;                    /* number of tracks per cylinder*/
  362.     short                             TPLGEO_NCYL;                /* number of cylinders, total*/
  363. };
  364. typedef struct GeometryTuple            GeometryTuple;
  365. /*-----------------    Byte-Order Tuple (43H)    -------------------                            */
  366.  
  367.  
  368. struct ByteOrderTuple {
  369.     char                             TPLBYTE_ORDER;                /* byte order code*/
  370.     char                             TPLBYTE_MAP;                /* byte mapping code*/
  371. };
  372. typedef struct ByteOrderTuple            ByteOrderTuple;
  373. /*    byte order codes*/
  374. enum {
  375.     TYPBYTEORD_LOW                = 0,
  376.     TYPBYTEORD_HIGH                = 1,
  377.     TYPBYTEORD_VS                = 0x80
  378. };
  379.  
  380. /*    byte mapping codes*/
  381.  
  382. enum {
  383.     TYPBYTEMAP_LOW                = 0,
  384.     TYPBYTEMAP_HIGH                = 1,
  385.     TYPBYTEMAP_VS                = 0x80
  386. };
  387.  
  388.  
  389. /*----------    Card Initialization Date Tuple (44H)    ------------                            */
  390.  
  391.  
  392. struct CardInitDateTuple {
  393.     UInt16                             TPLDATE_TIME;                /* hours, minutes, seconds*/
  394.     UInt16                             TPLDATE_DAY;                /* year, month, day*/
  395. };
  396. typedef struct CardInitDateTuple        CardInitDateTuple;
  397. /*----------    Battery-Replacement Date Tuple (45H)    ------------                            */
  398.  
  399.  
  400. struct BatteryReplaceDateTuple {
  401.     UInt16                             TPLBATT_RDAY;                /* last replacement date (year, month, day)*/
  402.     UInt16                             TPLBATT_XDAY;                /* battery expiration date (year, month, day)*/
  403. };
  404. typedef struct BatteryReplaceDateTuple    BatteryReplaceDateTuple;
  405.  
  406. /*----------------------    General Tuple    -----------------------                            */
  407.  
  408.  
  409. union TupleBody {
  410.     DeviceIDTuple                     deviceID;
  411.     ChecksumControlTuple             checksum;
  412.     LongLinkTuple                     link;
  413.     LinkTargetTuple                 target;
  414.     Level1VersionTuple                 level1;
  415.     JEDECIdentifierTuple             jedecID;
  416.     ConfigTuple                     config;
  417.     DeviceGeometryTuple             devGeo;
  418.     ManufIDTuple                     manufID;
  419.     FunctionIDTuple                 funcID;
  420.     SoftwareInterleaveTuple         swil;
  421.     Level2VersionTuple                 level2;
  422.     FormatTuple                     format;
  423.     GeometryTuple                     geometry;
  424.     ByteOrderTuple                     order;
  425.     CardInitDateTuple                 initDate;
  426.     BatteryReplaceDateTuple         battDate;
  427.     Byte                             tupleData[254];
  428. };
  429. typedef union TupleBody                    TupleBody;
  430.  
  431. struct Tuple {
  432.     Byte                             TPL_CODE;
  433.     Byte                             TPL_LINK;
  434.     TupleBody                         TPL_BODY;
  435. };
  436. typedef struct Tuple                    Tuple;
  437.  
  438. #if PRAGMA_STRUCT_ALIGN
  439.     #pragma options align=reset
  440. #elif PRAGMA_STRUCT_PACKPUSH
  441.     #pragma pack(pop)
  442. #elif PRAGMA_STRUCT_PACK
  443.     #pragma pack()
  444. #endif
  445.  
  446. #ifdef PRAGMA_IMPORT_OFF
  447. #pragma import off
  448. #elif PRAGMA_IMPORT
  449. #pragma import reset
  450. #endif
  451.  
  452. #ifdef __cplusplus
  453. }
  454. #endif
  455.  
  456. #endif /* __PCCARDTUPLES__ */
  457.  
  458.